<?php
declare (strict_types = 1);

namespace app\middleware;

class CheckLogin
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {
        $response = $next($request);
        $loginAdmin=session('adminSessionData');
        if(!$loginAdmin){
            if($request->controller() != "Login"){
                return redirect('/admin/login/index');die;
            }
        }
        return $response;

    }
}
